use serde_derive::{Serialize, Deserialize};
use lucky::{models::{AdminLogRow as ModelRow}, json::JsonPager};
use sqlx::{postgres::{PgRow}, row::Row,};
use crate::common::{Pool, models::BackendModel};

#[derive(Serialize, Deserialize, Debug)]
pub struct AdminLog;

impl BackendModel<ModelRow> for AdminLog {

    const TABLE_NAME: &'static str = "admin_logs";
    const FIELDS: &'static str = "id, admin_id, admin_name, log_type, url, remark, date, created";

    fn get_row_filter(r: &PgRow) -> ModelRow {
        unfold_fields!(r, {
            id => i32,
            admin_id => i32,
            admin_name => String,
            log_type => i16,
            url => String,
            remark => String,
        }, {}, {created,}, {date,})
    }
}

impl AdminLog {
    record_list!();
}
